// pm.cpp : main source file for pm.exe
//

#include "stdafx.h"

#include "resource.h"

#include "aboutdlg.h"
#include "MainWnd.h"

CAppModule _Module;

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	HRESULT hRes = MainWnd::ActivatePreviousInstance(hInstance, lpstrCmdLine);
	if(FAILED(hRes) || S_FALSE == hRes)
	{
		return hRes;
	}

    hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
    ATLASSERT(SUCCEEDED(hRes));

    AtlInitCommonControls(ICC_DATE_CLASSES);
    SHInitExtraControls();
    InitRichInkDLL();

    hRes = _Module.Init(NULL, hInstance);
    ATLASSERT(SUCCEEDED(hRes));

    int nRet = MainWnd::AppRun(lpstrCmdLine, nCmdShow);

    _Module.Term();
    ::CoUninitialize();

	return nRet;
}
